package com.xbongbong.workflow.model.impl;

import com.xbongbong.paas.toolbox.util.DateTimeUtil;
import com.xbongbong.workflow.domain.dao.WorkflowCommentDao;
import com.xbongbong.workflow.domain.entity.WorkflowCommentEntity;
import com.xbongbong.workflow.domain.entity.ext.WorkflowCommentEntityExt;
import com.xbongbong.workflow.model.WorkflowCommentModel;
import org.springframework.stereotype.Service;

import javax.annotation.Resource;
import java.util.List;
import java.util.Map;

/**
 */
@Service("workflowCommentModel")
public class WorkflowCommentModelImpl implements WorkflowCommentModel {
    @Resource
    private WorkflowCommentDao workflowCommentDao;

    @Override
    public Long insert(WorkflowCommentEntity entity) {
        long now = DateTimeUtil.getInt();
        entity.setAddTime(now);
        entity.setUpdateTime(now);
        return workflowCommentDao.insert(entity);
    }

    @Override
    public void insertBatch(List<WorkflowCommentEntity> list) {
        workflowCommentDao.insertBatch(list);
    }

    @Override
    public List<WorkflowCommentEntityExt> findEntities(Map<String, Object> param) {
        return workflowCommentDao.findEntities(param);
    }

    @Override
    public Integer getEntityCount(Map<String, Object> param) {
        return workflowCommentDao.getEntitiesCount(param);
    }

    @Override
    public void update(WorkflowCommentEntity entity) {
        entity.setUpdateTime(DateTimeUtil.getInt());
        workflowCommentDao.update(entity);
    }

    @Override
    public WorkflowCommentEntity getByKey(Long key, String corpid) {
        return workflowCommentDao.getByKey(key, corpid);
    }

}
